//
//  BDSettingViewController.m
//  IDLFaceSDKDemoOC
//
//  Created by Zhang,Jian(MBD) on 2021/6/2.
//  Copyright © 2021 Baidu. All rights reserved.
//

#import "BDSettingViewController.h"
#import "JSToastDialogs.h"
#import <BDFaceBaseKit/BDFaceBaseKit.h>
#import "BDFaceSelectConfigController.h"
#import "BDFaceLiveSelectViewController.h"
#import "BDFaceAirInterfaceViewController.h"
#import "BDFaceAdjustParamsFileManager.h"

@interface BDSettingViewController ()

// OCR功能
@property (weak, nonatomic) IBOutlet UISwitch *mySwitch;

// 非大陆身份认证
@property (weak, nonatomic) IBOutlet UISwitch *moreCardTypeSwitch;

// 业务场景名称label
@property (weak, nonatomic) IBOutlet UILabel *planLabel;

// 活体方案label
@property (weak, nonatomic) IBOutlet UILabel *livenessLabel;

// 质量控制label
@property (weak, nonatomic) IBOutlet UILabel *qualityLabel;

@end

//

@implementation BDSettingViewController

- (IBAction)goBackAction:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

// 质量控制点击进入详情配置页面
- (IBAction)qualityAction:(id)sender {
    NSLog(@"点击质量控制区域");
    BDFaceSelectConfigController *lvc = [[BDFaceSelectConfigController alloc] init];
    [self.navigationController pushViewController:lvc animated:YES];
}

/**
 活体方案页面点击进入详情页面
 */
- (IBAction)livenessAction:(id)sender {
    NSLog(@"点击活体方案区域");
    BDFaceLiveSelectViewController *lvc = [[BDFaceLiveSelectViewController alloc] init];
    lvc.selectType = [[NSUserDefaults standardUserDefaults] integerForKey:@"LiveSelectMode"];
    [self.navigationController pushViewController:lvc animated:YES];
}

/**
 业务场景点击进入详情
 */
- (IBAction)planAction:(id)sender {
    NSLog(@"点击业务场景区域");
    BDFaceAirInterfaceViewController *lvc = [[BDFaceAirInterfaceViewController alloc] init];
    NSInteger type = [[NSUserDefaults standardUserDefaults] integerForKey:@"AirInterface"];
    if (type == 0) {
        lvc.selectType = 1;
    } else {
        lvc.selectType = type;
    }
    [self.navigationController pushViewController:lvc animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
}

- (void)viewWillAppear:(BOOL)animated {
    // j代表云端接口选择的方式类型
    NSInteger j = [[NSUserDefaults standardUserDefaults] integerForKey:@"AirInterface"];
    // k代表云端活体控制
    NSInteger k = [[NSUserDefaults standardUserDefaults] integerForKey:@"AirLivingControl"];
    
    // 质量控制判断
    if ([BDFaceAdjustParamsFileManager sharedInstance].selectType == BDFaceSelectTypeNormal) {
        self.qualityLabel.text = @"正常";
    } else if ([BDFaceAdjustParamsFileManager sharedInstance].selectType == BDFaceSelectTypeLoose) {
        self.qualityLabel.text = @"宽松";
    } else if ([BDFaceAdjustParamsFileManager sharedInstance].selectType == BDFaceSelectTypeStrict) {
        self.qualityLabel.text = @"严格";
    } else {
        self.qualityLabel.text = @"正常";
    }
    
    // 判断活体方案
    if ([BDFaceBaseKitManager sharedInstance].paramsCustomConfigItem.isOpenDistanceLive) {
        self.livenessLabel.text = @"远近活体";
    } else {
        if ([BDFaceBaseKitManager sharedInstance].paramsCustomConfigItem.isColorType && [BDFaceBaseKitManager sharedInstance].paramsCustomConfigItem.isLivenessType) {
            self.livenessLabel.text = @"动作+炫瞳活体";
        } else if (![BDFaceBaseKitManager sharedInstance].paramsCustomConfigItem.isColorType && [BDFaceBaseKitManager sharedInstance].paramsCustomConfigItem.isLivenessType) {
            self.livenessLabel.text = @"动作活体";
        } else if ([BDFaceBaseKitManager sharedInstance].paramsCustomConfigItem.isColorType && ![BDFaceBaseKitManager sharedInstance].paramsCustomConfigItem.isLivenessType) {
            self.livenessLabel.text = @"炫瞳活体";
        } else if (![BDFaceBaseKitManager sharedInstance].paramsCustomConfigItem.isColorType && ![BDFaceBaseKitManager sharedInstance].paramsCustomConfigItem.isLivenessType) {
            self.livenessLabel.text = @"静默活体";
        }
    }
    
    // 云端接口类型判断
    if (j == 1) {
        self.planLabel.text = @"实名认证";
    } else if (j == 2 ) {
        self.planLabel.text = @"人脸对比";
    } else if (j == 3) {
        self.planLabel.text = @"在线图片活体";
    } else {
        self.planLabel.text = @"实名认证";
    }
    
    // 质量控制
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


